﻿using System.Data.Entity.ModelConfiguration;
using INSE6260.OnlineBanking.Model.ClientCard;

namespace INSE6260.OnlineBanking.Repository.EF.Mappings
{
    public class ClientCardTypeConfiguration : EntityTypeConfiguration<ClientCard>
    {
        public ClientCardTypeConfiguration()
        {					
    		this.HasKey(t => t.Id);		
    		this.ToTable("ClientCards");
    		this.Property(t => t.Id).HasColumnName("Id");
    		this.Property(t => t.CardNo).HasColumnName("CardNo").IsRequired().HasMaxLength(16);
    		this.Property(t => t.AccountId).HasColumnName("AccountID");
    		this.Property(t => t.CardType).HasColumnName("CardType").IsRequired().HasMaxLength(20);
    		this.Property(t => t.Password).HasColumnName("Password").IsRequired();
    		this.Property(t => t.ExpirationDate).HasColumnName("ExpirationDate");
    		this.Property(t => t.SecurityQuestion1).HasColumnName("SecurityQuestion1").IsRequired().HasMaxLength(100);
    		this.Property(t => t.SecurityQuestion2).HasColumnName("SecurityQuestion2").IsRequired().HasMaxLength(100);
    		this.Property(t => t.SecurityQuestion3).HasColumnName("SecurityQuestion3").IsRequired().HasMaxLength(100);
    		this.Property(t => t.SecurityAnswer1).HasColumnName("SecurityAnswer1").IsRequired().HasMaxLength(100);
    		this.Property(t => t.SecurityAnswer2).HasColumnName("SecurityAnswer2").IsRequired().HasMaxLength(100);
            this.Property(t => t.SecurityAnswer3).HasColumnName("SecurityAnswer3").IsRequired().HasMaxLength(100);
            this.Property(t => t.Status).HasColumnName("Status");
    		this.HasRequired(t => t.Account).WithMany(t => t.ClientCards).HasForeignKey(d => d.AccountId);
    	}
    }
}
